
requirejs.config({
    baseUrl: '../www',
    paths: {
        app: 'js/app',
        controllers: 'js/controllers/controllers',
        services: 'js/services/services',
        directives: 'js/directives/directives',
        utility: 'js/utility/utility',
        ionic: 'lib/ionic/js/ionic.bundle',
        ngCordova: 'lib/ngCordova/ng-cordova',
        appHelp: 'js/appHelp',
        ionicU9: 'lib/u9/ionicU9/ionicU9',
        pinyin: 'lib/pinyin/pinyin',
        md5: 'lib/md5/md5',
        ios9Patch: 'lib/ios9-$browser-patch',
        jquery: 'lib/jquery/jquery',
        jqueryui: 'lib/jquery-ui/jquery-ui',
        jqueryuitouch: 'lib/jquery-ui-touch/jquery.ui.touch-punch',
        angularDrapDrop: 'lib/angular-dragdrop/angular-dragdrop'
    },
    shim: {
        ionic: {
            deps: ['jquery']
        },
        jqueryui: {
            deps: ['jquery']
        },
        jqueryuitouch: {
            deps: ['jqueryui']
        },
        angularDrapDrop: {
            deps: ['ionic', 'jqueryui', 'jqueryuitouch']
        },
        ngCordova: {
            deps: ['ionic']
        },
        ionicU9: {
            deps: ['ionic']
        },
        ios9Patch: {
            deps: ['ionic']
        }
    }
});
requirejs.onError = function (err) {
    console.log(err.requireType);
    if (err.requireType === 'timeout') {
        console.log('modules: ' + err.requireModules);
    }

   alert(JSON.stringify(err))
};
requirejs(['appHelp', 'pinyin', 'md5', 'lib/MicrosoftAjax'], function () {
    // Start the main app logic.
    requirejs(['app'], function () {
        var onReady = function () {
            angular.bootstrap(document, ['U9Mobile']);
        };
        document.addEventListener("deviceready", onReady, false);
        if (typeof cordova === 'undefined') {
            angular.element(document).ready(function() {
                onReady();
            });
        }
    });
});